import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-07-03
 * Time: 11:54
 */
public class Test9 {

    public static List<Integer> findWordIndex(String p,String s) {
        List<Integer> ret = new ArrayList<>();
        int[] hash1 = new int[128];
        int[] hash2 = new int[128];
        char[] ch1 = p.toCharArray();
        char[] ch2 = s.toCharArray();

        for(char ch : ch2) {
            hash2[ch]++;
        }

        for(int left = 0, right = 0,count = 0; right < p.length(); right++) {
            char in = ch1[right];
            hash1[in]++;

            if(hash1[in] <= hash2[in]) {
                count++;
            }

            // 出窗口条件
            if(right-left+1 > s.length()) {
                char out = ch1[left];
                if(hash1[out] <= hash2[out]) {
                    count--;
                }
                hash1[out]--;
                left++;
            }

            if(count == s.length()) {
                ret.add(left);
            }

        }

        return ret;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String p = sc.nextLine();
        String s = sc.nextLine();
        List<Integer> ret = findWordIndex(p,s);
        System.out.println("字母异位词起始下标:"+ret);
    }
}
